<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
	<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/page.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/double-date.css" rel="stylesheet">
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/double-date.js"></script>
</head>

<style>
.table1 .xinxiinfo1{
	width:13%;
	height:50px;
	text-align:right;
	background-color:#F5F5F6;
}
.table1 .xinxiinfo2{
	width:87%;
	height:50px;
	text-align:left;
}
</style>

<body class="gray-bg" >
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>订单基本信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                                <tr><td class="xinxiinfo1">订单号：</td><td class="xinxiinfo2">{$orders.ordernumber}</td></tr>
                                <tr><td class="xinxiinfo1">订单类型：</td><td class="xinxiinfo2">{if condition="$orders['order_type'] eq 1"}普通订单{elseif condition="$orders['order_type'] eq 2"/}拼团订单{/if}</td></tr>
                                {if condition="$orders['order_type'] eq 2 && $pintuans && $assembles"}
                                <tr>
                                <td class="xinxiinfo1">拼团状态：</td>
                                <td class="xinxiinfo2">
                                {if condition="$assembles['state'] eq 0 && $assembles['tui_status'] eq 0 && $assembles['pin_type'] eq 1 && $pintuans['state'] eq 0 && $pintuans['pin_status'] eq 0"}
                                <font style="color:#1c84c6;">待支付开团</font>
                                {elseif condition="$assembles['state'] eq 0 && $assembles['tui_status'] eq 0 && $assembles['pin_type'] eq 2 && $pintuans['state'] eq 1 && $pintuans['pin_status'] eq 0"}
                                <font style="color:#1c84c6;">待支付参团</font>
                                {elseif condition="$assembles['state'] eq 1 && $assembles['tui_status'] eq 0 && $pintuans['state'] eq 1 && $pintuans['pin_status'] eq 0"}
                                <font style="color:#1c84c6;">邀请好友参团</font>
                                {elseif condition="$assembles['state'] eq 1 && $assembles['tui_status'] eq 1 && $pintuans['state'] eq 1 && $pintuans['pin_status'] eq 0"}
                                <font style="color:#F00;">已退款退出拼团</font>
                                {elseif condition="$assembles['state'] eq 1 && $assembles['tui_status'] eq 0 && $pintuans['state'] eq 1 && $pintuans['pin_status'] eq 1"}
                                <font style="color:#1992FC;">拼团成功</font>
                                {elseif condition="$assembles['state'] eq 1 && $assembles['tui_status'] eq 1 && $pintuans['state'] eq 1 && $pintuans['pin_status'] eq 2"}
                                <font style="color:#F00;">拼团失败</font>
                                {/if}
                                </td>
                                </tr> 
                                {/if}                               
                                <tr>
                                <td class="xinxiinfo1">订单状态：</td>
                                <td class="xinxiinfo2">
                                {switch name="orders.zhuangtai"}
                                {case value="1"}<font style="color:#1c84c6;">待发货</font>{/case}
                                {case value="2"}<font style="color:#1c84c6;">已发货</font>{/case}
                                {case value="3"}<font style="color:#1992FC;">已完成</font>{/case}
                                {case value="4"}<font style="color:#1c84c6;">待支付</font>{/case}
                                {case value="5"}<font style="color:#F00;">已关闭</font>{/case}
                                {case value="6"}<font style="color:#F00;">已取消</font>{/case}
                                {/switch}
                                </td>
                                </tr>
                                <tr><td class="xinxiinfo1">总价：</td><td class="xinxiinfo2">{$orders.total_price}&nbsp;元</td></tr>	
                                <tr><td class="xinxiinfo1">备注：</td><td class="xinxiinfo2">{if condition="$orders['beizhu']"}{$orders.beizhu}{else/}/{/if}</td></tr>
                                <tr><td class="xinxiinfo1">订单提交时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['addtime'])}</td></tr>		
                                {switch name="orders.zhuangtai"}
                                {case value="1"}
                                <tr><td class="xinxiinfo1">支付时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['pay_time'])}</td></tr>
                                <tr><td class="xinxiinfo1">支付方式：</td><td class="xinxiinfo2">{if condition="$orders['zf_type'] eq 1"}支付宝支付{elseif condition="$orders['zf_type'] eq 2"/}微信支付{elseif condition="$orders['zf_type'] eq 3"/}余额支付{/if}</td></tr>
                                {/case}
                                {case value="2"}
                                <tr><td class="xinxiinfo1">支付时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['pay_time'])}</td></tr>
                                <tr><td class="xinxiinfo1">支付方式：</td><td class="xinxiinfo2">{if condition="$orders['zf_type'] eq 1"}支付宝支付{elseif condition="$orders['zf_type'] eq 2"/}微信支付{elseif condition="$orders['zf_type'] eq 3"/}余额支付{/if}</td></tr>
                                <tr><td class="xinxiinfo1">发货时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['fh_time'])}</td></tr>
                                {/case}
                                {case value="3"}
                                <tr><td class="xinxiinfo1">支付时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['pay_time'])}</td></tr>
                                <tr><td class="xinxiinfo1">支付方式：</td><td class="xinxiinfo2">{if condition="$orders['zf_type'] eq 1"}支付宝支付{elseif condition="$orders['zf_type'] eq 2"/}微信支付{elseif condition="$orders['zf_type'] eq 3"/}余额支付{/if}</td></tr>
                                <tr><td class="xinxiinfo1">发货时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['fh_time'])}</td></tr>
                                <tr><td class="xinxiinfo1">用户确认收货时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['coll_time'])}</td></tr>
                                {/case}
                                {case value="5"}
                                <tr><td class="xinxiinfo1">关闭时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['can_time'])}</td></tr>
                                {/case}
                                {/switch}
                                <tr><td class="xinxiinfo1">会员昵称：</td><td class="xinxiinfo2">{$orders.user_name}</td></tr>	
                                <tr><td class="xinxiinfo1">会员手机号：</td><td class="xinxiinfo2">{$orders.phone}</td></tr>	
                                <tr><td class="xinxiinfo1">订单所属区域：</td><td class="xinxiinfo2">{$orders.pro_name}&nbsp;{$orders.city_name}&nbsp;{$orders.area_name}</td></tr>	
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>订单商品信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-hover table-bordered">
                            <thead>
                                <tr>
                                    <th style="width:15%">缩略图</th> 
                                    <th style="width:15%">商品名称</th>
                                    <th style="width:15%">商品属性</th>
                                    <th style="width:10%">单价</th> 
                                    <th style="width:10%">数量</th> 
                                    <th style="width:10%">活动信息</th>
                                    <th style="width:10%">促销信息</th>
                                    <th style="width:10%">状态</th>  
                                    <th style="width:10%">小计</th>
                                </tr>
                            </thead>
                        
                            <tbody>
                                {foreach name="order_goodres" item="v"}
                                <tr>
                                <td><img src="{$v.thumb_url}" width="125px" height="75px" /></td>
                                <td>{$v.goods_name}</td>
                                <td>{if condition="$v['goods_attr_str']"}{$v.goods_attr_str}{else/}无{/if}</td>
                                <td>{$v.real_price}&nbsp;元</td>
                                <td>{$v.goods_num}</td>
                                <td>{switch name="v.hd_type"}{case value="0"}无{/case}{case value="1"}秒杀商品{/case}{case value="2"}团购商品{/case}{/switch}</td>
                                <td>{if condition="$v['prom_id']"}{$v.prom_str}{else/}无{/if}</td>
                                <td>
                                {switch name="v.th_status"}
                                {case value="0"}<font style="color:#1992FC;">正常</font>{/case}
                                {case value="1"}<font style="color:#f8ac59;">申请退款中</font>{/case}
                                {case value="2"}<font style="color:#f8ac59;">退款中</font>{/case}
                                {case value="3"}<font style="color:#F00;">拒绝退款</font>{/case}
                                {case value="4"}<font style="color:#1992FC;">退款完成</font>{/case}
                                {case value="5"}<font style="color:#f8ac59;">申请换货中</font>{/case}
                                {case value="6"}<font style="color:#f8ac59;">换货中</font>{/case}
                                {case value="7"}<font style="color:#F00;">拒绝换货</font>{/case}
                                {case value="8"}<font style="color:#1992FC;">换货完成</font>{/case}
                                {/switch}
                                </td>
                                <td>{$v.dan_price}&nbsp;元</td>
                                </tr>
	                            {/foreach}
	                            {if condition="$orders['coupon_id']"}
	                            <tr>
	                            <td colspan="9" style="text-align:right; font-size:14px;">
	                                                                             店铺优惠券：{$orders['coupon_str']}&nbsp;&nbsp;
	                            </td>
	                            </tr>
	                            {/if}
	                            <tr>
	                            <td colspan="9" style="text-align:right;">
	                            <p>商品总价：{$orders.goods_price}&nbsp;元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
	                            <p>运费：{$orders.freight}&nbsp;元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
	                            <p>店铺优惠：-{$orders.youhui_price}&nbsp;元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
	                            <p style="color:#F00; font-size:15px;">订单总价：{$orders.total_price}&nbsp;元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
	                            </td>
	                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    {if condition="$orders['type'] eq 1"}
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>配送信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                            <tr><td class="xinxiinfo1">收货人：</td><td class="xinxiinfo2">{$orders.contacts}</td></tr>
                            <tr><td class="xinxiinfo1">联系电话：</td><td class="xinxiinfo2">{$orders.telephone}</td></tr>
                            <tr><td class="xinxiinfo1">地址：</td><td class="xinxiinfo2">{$orders.province}{$orders.city}{$orders.area}{$orders.address}</td></tr>
                            {if condition="$orders['state'] eq 1 && $orders['order_status'] eq 0"}
                            {if condition="($orders['order_type'] eq 1) || ($orders['order_type'] eq 2 && $pintuans['pin_status'] eq 1)"}
                            <tr>
                                <td class="xinxiinfo1">选择物流：</td>
                                <td class="xinxiinfo2">
                                    <select class="form-control m-b" name="ps_id" id="wuliu">
                                        <option value="">请选择</option>
                                        {foreach name="psres" item="v"}
                                        <option value="{$v.id}" {if condition="isset($wulius['ps_id']) && $wulius['ps_id'] eq $v['id']"}selected="selected"{/if}>{$v.log_name}</option>
                                        {/foreach}
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="xinxiinfo1">运单号：</td>
                                <td class="xinxiinfo2">
                                    <input type="text" name="psnum" {if condition="isset($wulius['psnum']) && $wulius['psnum']"}value="{$wulius.psnum}"{/if} class="form-control">
                                </td>
                            </tr>
                            <tr>
                                <input type="hidden" name="id" value="{$orders.id}">
                                <td colspan="2" style="text-align:center; font-size:14px;"><button class="btn btn-primary" type="button" id="doSubmit" style="margin-right:50px;">保存发货信息</button>{if condition="$orders['fh_status'] eq 0"}<button type="button" class="btn btn-success" id="doSubmitqr">确认发货</button>{/if}</td>
                            </tr>
                            {/if}
                            {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {else/}
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>配送信息 - 用户自提(核销)</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                            <tr><td class="xinxiinfo1">收货人：</td><td class="xinxiinfo2">{$orders.contacts}</td></tr>
                            <tr><td class="xinxiinfo1">联系电话：</td><td class="xinxiinfo2">{$orders.telephone}</td></tr>
                            <tr><td class="xinxiinfo1">核销码：</td><td class="xinxiinfo2">{$orders.check_order_sn}</td></tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {/if}
    {if condition="$orders['order_status'] eq 3 && $orders['user_dakuan_status'] eq 0 && $orders['state'] eq 1"}
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>操作</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                            {if condition="$applys['user_dakuan_status'] eq 0"}
                            <tr>
                                <input type="hidden" name="id" value="{$orders.id}">
                                <td colspan="2" style="text-align:center; font-size:14px;">{if condition="$orders['user_dakuan_status'] eq 0"}<button type="button" class="btn btn-success" id="dkSubmitqr">确认打款</button>{/if}</td>
                            </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {elseif condition="$orders['order_status'] eq 3"}
    <div class="wrapper wrapper-content" style="padding-bottom:0px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>取消信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-bordered table1">
                            <tbody>
                            {if condition="$orders['user_dakuan_status'] eq 0"}
                            <tr><td class="xinxiinfo1">订单状态：</td><td class="xinxiinfo2">已取消</td></tr>
                            <tr><td class="xinxiinfo1">取消时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['can_time'])}</td></tr>
                            {elseif condition="$orders['user_dakuan_status'] eq 1"}
                            <tr><td class="xinxiinfo1">订单状态：</td><td class="xinxiinfo2">已取消</td></tr>
                            <tr><td class="xinxiinfo1">取消时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['can_time'])}</td></tr>
                            <tr><td class="xinxiinfo1">是否打款：</td><td class="xinxiinfo2">是</td></tr>
                            <tr><td class="xinxiinfo1">打款时间：</td><td class="xinxiinfo2">{:date('Y-m-d H:i:s',$orders['user_dakuan_time'])}</td></tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {/if}
    
    

    <!-- 全局js -->
    <script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script> 
    <script src="__PUBLIC__/admin/js/common/ajax.js"></script>
    
    <script>
    $(function(){
    	{if condition="$orders['state'] eq 1 && $orders['order_status'] eq 0"}
    	{if condition="($orders['order_type'] eq 1) || ($orders['order_type'] eq 2 && $pintuans['pin_status'] eq 1)"}
        $('#doSubmit').click(function(){
        	var ps_id = $('#wuliu').val();
        	if(!ps_id){
        		layer.msg('请选择物流', {icon: 2,time: 2000});
        		return false;
        	}
        	
        	var psnum = $('input[name=psnum]').val();
        	if(psnum == ''){
        		layer.msg('请填写运单号', {icon: 2,time: 2000});
        		return false;
        	}
        	
        	var order_id = $('input[name=id]').val();
        	
        	if(!order_id){
        		layer.msg('缺少订单信息', {icon: 2,time: 2000});
        		return false;
        	}
        	
        	layer.load(2);
        	
    		$.ajax({
  			   url:"{:url('order/savewuliu')}",
  			   type:'POST',
  			   data:{'ps_id':ps_id,'psnum':psnum,'order_id':order_id},
  		       dataType:'json',
  			   success:function(data){
  					if(data.status == 1){
  						layer.closeAll('loading');
  			        	layer.msg(data.mess, {icon: 1,time: 1000},function(){
  			        		location.reload();
  			         	});	
  					}else{
  						layer.closeAll('loading');
  						layer.msg(data.mess, {icon: 2,time: 2000});
  					}
  			   },
  		       error:function(){
  		           layer.closeAll('loading');
  		           layer.msg('操作失败或您没有权限，请重试', {icon: 2,time: 2000});
  		       }
  		    });
        });
        
        {if condition="$orders['fh_status'] eq 0"}
        $('#doSubmitqr').click(function(){
	  		layer.confirm('确定发货么？', {  			  
				skin: 'layui-layer-molv',
				closeBtn: 0,
				shadeClose : true,
				btn: ['确定','取消'] //按钮
			},function(){
	        	var ps_id = $('#wuliu').val();
	        	if(!ps_id){
	        		layer.msg('请选择物流', {icon: 2,time: 2000});
	        		return false;
	        	}
	        	
	        	var psnum = $('input[name=p_psnum]').val();
	        	if(psnum == ''){
	        		layer.msg('请填写运单号', {icon: 2,time: 2000});
	        		return false;
	        	}
	        	
	        	var order_id = $('input[name=id]').val();
	        	
	        	if(!order_id){
	        		layer.msg('缺少订单信息', {icon: 2,time: 2000});
	        		return false;
	        	}
	        	
	        	layer.load(2);
	        	
	    		$.ajax({
	  			   url:"{:url('order/fachu')}",
	  			   type:'POST',
	  			   data:{'order_id':order_id},
	  		       dataType:'json',
	  			   success:function(data){
	 					if(data.status == 1){
	 						layer.closeAll('loading');
	 			        	layer.msg(data.mess, {icon: 1,time: 1000},function(){
	 			        		location.reload();
	 			         	});	
	 					}else{
	 						layer.closeAll('loading');
	 						layer.msg(data.mess, {icon: 2,time: 2000});
	 					}
	 			   },
	 		       error:function(){
	 		           layer.closeAll('loading');
	 		           layer.msg('操作失败或您没有权限，请重试', {icon: 2,time: 2000});
	 		       }
	  		    });
			}); 
        });
        {/if}
        {/if}
        {/if}
        {if condition="$orders['order_status'] eq 3 && $orders['user_dakuan_status'] eq 0 && $orders['state'] eq 1"}
        $('#dkSubmitqr').click(function(){
            layer.confirm('确定打款么？', {
                skin: 'layui-layer-molv',
                closeBtn: 0,
                shadeClose : true,
                btn: ['确定','取消'] //按钮
            },function(){

                var order_id = $('input[name=id]').val();

                if(!order_id){
                    layer.msg('缺少订单信息', {icon: 2,time: 2000});
                    return false;
                }

                layer.load(2);

                $.ajax({
                    url:"{:url('order/payment')}",
                    type:'POST',
                    data:{'order_id':order_id},
                    dataType:'json',
                    success:function(data){
                        if(data.status == 1){
                            layer.closeAll('loading');
                            layer.msg(data.mess, {icon: 1,time: 1000},function(){
                                location.reload();
                            });
                        }else{
                            layer.closeAll('loading');
                            layer.msg(data.mess, {icon: 2,time: 2000});
                        }
                    },
                    error:function(){
                        layer.closeAll('loading');
                        layer.msg('操作失败或您没有权限，请重试', {icon: 2,time: 2000});
                    }
                });
            });
        });

        {/if}
    });

    </script>

</body>
</html>